const app = getApp();
const controllers = app.controllers;

Page({
  data: {
    id:null,
    dataInfo:{},
  },
  onLoad: function (options) {
    this.data.id = options.id;
    this.getInfo(this.data.id);
  },
  getInfo: function (id) {
    let that = this; 
    return app.requestApi("/api/vip/myDetail",{accountVipId: id}).then(data =>{
      that.setData({
        dataInfo:data
      });
    });

  },
  onBack(){
    wx.navigateBack();
  },

  onCardUse(e){
    var db = e.currentTarget.dataset;
    let that = this;
    app.util.confirm("确认要核销项目吗？").then(()=>{
      return app.requestApi("/api/vip/receive",{vipGoodsId: db.id}).then(data =>{
        wx.showToast({
          title: "核销成功",
          icon: 'none',
        });
      });
    }).then(()=>{
      return this.getInfo(that.data.id);
    });
    
  },

  show(content,title){

    wx.showModal({
      title: title||'温馨提示',
      content: '',
      success (res) {
        if (res.confirm) {
          console.log('用户点击确定')
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    });
  }
  

  

})